
data = {
    "cases": [
        {
            "case_name": "输入正确的用户名和密码进行登录",
            "data": {
                "path": "/api/admin/login",
                "method": "post",
                "params": {
                    "username": "admin",
                    "password": "123456"
                },
                "assert": {
                    "code": 1,
                    "message": "成功"
                }
            }
        }
    ]
}

import yaml

def save_yaml(data,filename):
    with open(filename,mode='w',encoding='utf-8') as f:
        yaml.safe_dump(data,f,allow_unicode=True,sort_keys=False)


if __name__ == '__main__':

    save_yaml(data,'login.yaml')
